import { createRouter, createWebHashHistory } from "vue-router";
import {
  Goods,
  GoodsFilled,
  ScaleToOriginal,
  Star,
  UserFilled,
} from "@element-plus/icons-vue";
import Category from "../views/category/index.vue";
import Live from "../views/live/index.vue";
import Account from "../views/account/index.vue";
import StarManage from "../views/StarManage.vue";
import Product from "../views/product/index.vue";
import Dashboard from "../views/dashboard/index.vue";

// 配置路径-组件的映射关系
export const routes = [
  {
    path: "/dashboard",
    component: Dashboard,
    meta: { title: "数据统计", icon: Goods },
  },
  {
    path: "/category",
    component: Category,
    meta: { title: "分类管理", icon: Goods },
  },
  {
    path: "/live",
    component: Live,
    meta: { title: "生活馆管理", icon: ScaleToOriginal },
  },
  {
    path: "/user",
    component: Account,
    meta: { title: "账号管理", icon: UserFilled },
  },
  {
    path: "/star",
    component: StarManage,
    meta: { title: "明星管理", icon: Star },
  },
  {
    path: "/prod",
    component: Product,
    meta: { title: "商品管理", icon: GoodsFilled },
  },
];

// 基于映射关系，生成路由对象
const router = createRouter({
  history: createWebHashHistory(), //配置路由模式，哈希模式
  routes: routes,
});

// 抛出路由对象
export default router;
